package edu.szte.ovrt.datahandler.model;

import java.util.List;

import static edu.szte.ovrt.datahandler.test.ModelFactory.*;

import org.junit.Test;

import static org.junit.Assert.*;

public class DocumentTest {
	@Test
	public void testGetSections() {
		final Document document = new Document();
		final List<Section> sections1 = document.getSections();
		assertNotNull(sections1);
		final List<Section> sections2 = document.getSections();
		assertSame(sections1, sections2);
	}

	@Test
	public void testEqualsEmpty() {
		final Document document1 = createDocumentEmpty();
		final Document document2 = createDocumentEmpty();
		assertTrue(document1.equals(document2));
	}

	@Test
	public void testEqualsOneItem() {
		final Document document1 = createDocumentWithOneSection();
		final Document document2 = createDocumentWithOneSection();
		assertTrue(document1.equals(document2));
	}

	@Test
	public void testEqualsMoreItems() {
		final Document document1 = createDocumentFull();
		final Document document2 = createDocumentFull();
		assertTrue(document1.equals(document2));
	}

	@Test
	public void testEqualsNull() {
		final Document document1 = createDocumentEmpty();
		assertFalse(document1.equals(null));
	}

	@Test
	public void testEqualsOther() {
		final Document document1 = createDocumentWithOneSection();
		assertFalse(document1.equals(new Object()));
	}

	@Test
	public void testEqualsFalse() {
		final Document document1 = createDocumentEmpty();
		final Document document2 = createDocumentWithOneSection();
		assertFalse(document1.equals(document2));
	}
}
